<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"/><meta name="viewport" content="width=device-width, initial-scale=0.8"/><title>7.3&nbsp;一般功能合约</title><link rel="stylesheet" type="text/css" href="scribble.css" title="default"/><link rel="stylesheet" type="text/css" href="racket.css" title="default"/><link rel="stylesheet" type="text/css" href="manual-style.css" title="default"/><link rel="stylesheet" type="text/css" href="manual-racket.css" title="default"/><script type="text/javascript" src="scribble-common.js"></script><script type="text/javascript" src="manual-racket.js"></script><!--[if IE 6]><style type="text/css">.SIEHidden { overflow: hidden; }</style><![endif]--></head><body id="scribble-racket-lang-org"><div class="tocset"><div class="tocview"><div class="tocviewlist tocviewlisttopspace"><div class="tocviewtitle"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,&quot;tocview_0&quot;);">&#9658;</a></td><td></td><td><a href="index.html" class="tocviewlink" data-pltdoc="x">Racket&#25351;&#21335;</a></td></tr></table></div><div class="tocviewsublisttop" style="display: none;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1&nbsp;</td><td><a href="intro.html" class="tocviewlink" data-pltdoc="x">&#27426;&#36814;&#26469;&#21040;Racket!</a></td></tr><tr><td align="right">2&nbsp;</td><td><a href="to-scheme.html" class="tocviewlink" data-pltdoc="x">Racket&#27010;&#35201;</a></td></tr><tr><td align="right">3&nbsp;</td><td><a href="datatypes.html" class="tocviewlink" data-pltdoc="x">&#20869;&#32622;&#30340;&#25968;&#25454;&#31867;&#22411;</a></td></tr><tr><td align="right">4&nbsp;</td><td><a href="scheme-forms.html" class="tocviewlink" data-pltdoc="x">&#34920;&#36798;&#24335;&#21644;&#23450;&#20041;</a></td></tr><tr><td align="right">5&nbsp;</td><td><a href="define-struct.html" class="tocviewlink" data-pltdoc="x">&#31243;&#24207;&#21592;&#23450;&#20041;&#30340;&#25968;&#25454;&#31867;&#22411;</a></td></tr><tr><td align="right">6&nbsp;</td><td><a href="modules.html" class="tocviewlink" data-pltdoc="x">&#27169;&#22359;</a></td></tr><tr><td align="right">7&nbsp;</td><td><a href="contracts.html" class="tocviewselflink" data-pltdoc="x">&#21512;&#32422;</a></td></tr><tr><td align="right">8&nbsp;</td><td><a href="i_o.html" class="tocviewlink" data-pltdoc="x">&#36755;&#20837;&#21644;&#36755;&#20986;</a></td></tr><tr><td align="right">9&nbsp;</td><td><a href="regexp.html" class="tocviewlink" data-pltdoc="x">&#27491;&#21017;&#34920;&#36798;&#24335;</a></td></tr><tr><td align="right">10&nbsp;</td><td><a href="control.html" class="tocviewlink" data-pltdoc="x">&#24322;&#24120;&#19982;&#25511;&#21046;</a></td></tr><tr><td align="right">11&nbsp;</td><td><a href="for.html" class="tocviewlink" data-pltdoc="x">&#36845;&#20195;&#21644;&#25512;&#23548;</a></td></tr><tr><td align="right">12&nbsp;</td><td><a href="match.html" class="tocviewlink" data-pltdoc="x">&#27169;&#24335;&#21305;&#37197;</a></td></tr><tr><td align="right">13&nbsp;</td><td><a href="classes.html" class="tocviewlink" data-pltdoc="x">&#31867;&#21644;&#23545;&#35937;</a></td></tr><tr><td align="right">14&nbsp;</td><td><a href="units.html" class="tocviewlink" data-pltdoc="x">&#21333;&#20803;</a></td></tr><tr><td align="right">15&nbsp;</td><td><a href="reflection.html" class="tocviewlink" data-pltdoc="x">&#21453;&#23556;&#21644;&#21160;&#24577;&#27714;&#20540;</a></td></tr><tr><td align="right">16&nbsp;</td><td><a href="macros.html" class="tocviewlink" data-pltdoc="x">&#23439;</a></td></tr><tr><td align="right">17&nbsp;</td><td><a href="languages.html" class="tocviewlink" data-pltdoc="x">&#21019;&#36896;&#35821;&#35328;</a></td></tr><tr><td align="right">18&nbsp;</td><td><a href="concurrency.html" class="tocviewlink" data-pltdoc="x">&#24182;&#21457;&#19982;&#21516;&#27493;</a></td></tr><tr><td align="right">19&nbsp;</td><td><a href="performance.html" class="tocviewlink" data-pltdoc="x">&#24615;&#33021;</a></td></tr><tr><td align="right">20&nbsp;</td><td><a href="parallelism.html" class="tocviewlink" data-pltdoc="x">&#24182;&#34892;</a></td></tr><tr><td align="right">21&nbsp;</td><td><a href="running.html" class="tocviewlink" data-pltdoc="x">&#36816;&#34892;&#21644;&#21019;&#24314;&#21487;&#25191;&#34892;&#31243;&#24207;</a></td></tr><tr><td align="right">22&nbsp;</td><td><a href="More_Libraries.html" class="tocviewlink" data-pltdoc="x">&#26356;&#22810;&#30340;&#24211;</a></td></tr><tr><td align="right">23&nbsp;</td><td><a href="dialects.html" class="tocviewlink" data-pltdoc="x">Racket&#21644;Scheme&#30340;&#26041;&#35328;</a></td></tr><tr><td align="right">24&nbsp;</td><td><a href="other-editors.html" class="tocviewlink" data-pltdoc="x">&#21629;&#20196;&#34892;&#24037;&#20855;&#21644;&#20320;&#30340;&#32534;&#36753;&#22120;&#36873;&#25321;</a></td></tr><tr><td align="right"></td><td><a href="doc-bibliography.html" class="tocviewlink" data-pltdoc="x">Bibliography</a></td></tr><tr><td align="right"></td><td><a href="doc-index.html" class="tocviewlink" data-pltdoc="x">Index</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,&quot;tocview_1&quot;);">&#9660;</a></td><td>7&nbsp;</td><td><a href="contracts.html" class="tocviewlink" data-pltdoc="x">&#21512;&#32422;</a></td></tr></table><div class="tocviewsublist" style="display: block;" id="tocview_1"><table cellspacing="0" cellpadding="0"><tr><td align="right">7.1&nbsp;</td><td><a href="contract-boundaries.html" class="tocviewlink" data-pltdoc="x">&#21512;&#32422;&#21644;&#36793;&#30028;</a></td></tr><tr><td align="right">7.2&nbsp;</td><td><a href="contract-func.html" class="tocviewlink" data-pltdoc="x">&#20989;&#25968;&#30340;&#31616;&#21333;&#21512;&#32422;</a></td></tr><tr><td align="right">7.3&nbsp;</td><td><a href="" class="tocviewselflink" data-pltdoc="x">&#19968;&#33324;&#21151;&#33021;&#21512;&#32422;</a></td></tr><tr><td align="right">7.4&nbsp;</td><td><a href="contracts-first.html" class="tocviewlink" data-pltdoc="x">&#21512;&#32422;&#65306;&#19968;&#20010;&#23436;&#25972;&#30340;&#20363;&#23376;</a></td></tr><tr><td align="right">7.5&nbsp;</td><td><a href="contracts-struct.html" class="tocviewlink" data-pltdoc="x">&#32467;&#26500;&#19978;&#30340;&#21512;&#32422;</a></td></tr><tr><td align="right">7.6&nbsp;</td><td><a href="contracts-exists.html" class="tocviewlink" data-pltdoc="x">&#29992;<span class="RktPn">#:<span class="mywbr"> &nbsp;</span>exists</span>&#21644;<span class="RktPn">#:<span class="mywbr"> &nbsp;</span>&#8707;</span>&#25277;&#35937;&#21512;&#32422;</a></td></tr><tr><td align="right">7.7&nbsp;</td><td><a href="contracts-examples.html" class="tocviewlink" data-pltdoc="x">&#38468;&#21152;&#23454;&#20363;</a></td></tr><tr><td align="right">7.8&nbsp;</td><td><a href="Building-New-Contracts.html" class="tocviewlink" data-pltdoc="x">&#24314;&#31435;&#26032;&#21512;&#32422;</a></td></tr><tr><td align="right">7.9&nbsp;</td><td><a href="contracts-gotchas.html" class="tocviewlink" data-pltdoc="x">&#38382;&#39064;</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,&quot;tocview_2&quot;);">&#9658;</a></td><td>7.3&nbsp;</td><td><a href="" class="tocviewselflink" data-pltdoc="x">&#19968;&#33324;&#21151;&#33021;&#21512;&#32422;</a></td></tr></table><div class="tocviewsublistbottom" style="display: none;" id="tocview_2"><table cellspacing="0" cellpadding="0"><tr><td align="right">7.3.1&nbsp;</td><td><a href="#%28part._contracts-optional%29" class="tocviewlink" data-pltdoc="x">&#21487;&#36873;&#21442;&#25968;</a></td></tr><tr><td align="right">7.3.2&nbsp;</td><td><a href="#%28part._contracts-rest-args%29" class="tocviewlink" data-pltdoc="x">&#21097;&#20313;&#21442;&#25968;</a></td></tr><tr><td align="right">7.3.3&nbsp;</td><td><a href="#%28part._contracts-keywords%29" class="tocviewlink" data-pltdoc="x">&#20851;&#38190;&#23383;&#21442;&#25968;</a></td></tr><tr><td align="right">7.3.4&nbsp;</td><td><a href="#%28part._contracts-optional-keywords%29" class="tocviewlink" data-pltdoc="x">&#21487;&#36873;&#20851;&#38190;&#23383;&#21442;&#25968;</a></td></tr><tr><td align="right">7.3.5&nbsp;</td><td><a href="#%28part._contracts-case-lambda%29" class="tocviewlink" data-pltdoc="x"><span class="RktSym"><span class="badlink"><span class="RktValLink">case-<wbr></wbr>lambda</span></span></span>&#30340;&#21512;&#32422;</a></td></tr><tr><td align="right">7.3.6&nbsp;</td><td><a href="#%28part._contracts-arrow-d%29" class="tocviewlink" data-pltdoc="x">&#21442;&#25968;&#21644;&#32467;&#26524;&#20381;&#36182;</a></td></tr><tr><td align="right">7.3.7&nbsp;</td><td><a href="#%28part._contracts-arrow-d-eval-order%29" class="tocviewlink" data-pltdoc="x">&#26816;&#26597;&#29366;&#24577;&#21464;&#21270;</a></td></tr><tr><td align="right">7.3.8&nbsp;</td><td><a href="#%28part._contracts-multiple%29" class="tocviewlink" data-pltdoc="x">&#22810;&#20010;&#32467;&#26524;&#20540;</a></td></tr><tr><td align="right">7.3.9&nbsp;</td><td><a href="#%28part._contracts-no-domain%29" class="tocviewlink" data-pltdoc="x">&#22266;&#23450;&#20294;&#38745;&#24577;&#26410;&#30693;&#25968;&#37327;</a></td></tr></table></div></div></div><div class="tocsub"><div class="tocsubtitle">On this page:</div><table class="tocsublist" cellspacing="0"><tr><td><span class="tocsublinknumber">7.3.1<tt>&nbsp;</tt></span><a href="#%28part._contracts-optional%29" class="tocsubseclink" data-pltdoc="x">&#21487;&#36873;&#21442;&#25968;</a></td></tr><tr><td><span class="tocsublinknumber">7.3.2<tt>&nbsp;</tt></span><a href="#%28part._contracts-rest-args%29" class="tocsubseclink" data-pltdoc="x">&#21097;&#20313;&#21442;&#25968;</a></td></tr><tr><td><span class="tocsublinknumber">7.3.3<tt>&nbsp;</tt></span><a href="#%28part._contracts-keywords%29" class="tocsubseclink" data-pltdoc="x">&#20851;&#38190;&#23383;&#21442;&#25968;</a></td></tr><tr><td><span class="tocsublinknumber">7.3.4<tt>&nbsp;</tt></span><a href="#%28part._contracts-optional-keywords%29" class="tocsubseclink" data-pltdoc="x">&#21487;&#36873;&#20851;&#38190;&#23383;&#21442;&#25968;</a></td></tr><tr><td><span class="tocsublinknumber">7.3.5<tt>&nbsp;</tt></span><a href="#%28part._contracts-case-lambda%29" class="tocsubseclink" data-pltdoc="x"><span class="RktSym"><span class="badlink"><span class="RktValLink">case-<wbr></wbr>lambda</span></span></span>&#30340;&#21512;&#32422;</a></td></tr><tr><td><span class="tocsublinknumber">7.3.6<tt>&nbsp;</tt></span><a href="#%28part._contracts-arrow-d%29" class="tocsubseclink" data-pltdoc="x">&#21442;&#25968;&#21644;&#32467;&#26524;&#20381;&#36182;</a></td></tr><tr><td><span class="tocsublinknumber">7.3.7<tt>&nbsp;</tt></span><a href="#%28part._contracts-arrow-d-eval-order%29" class="tocsubseclink" data-pltdoc="x">&#26816;&#26597;&#29366;&#24577;&#21464;&#21270;</a></td></tr><tr><td><span class="tocsublinknumber">7.3.8<tt>&nbsp;</tt></span><a href="#%28part._contracts-multiple%29" class="tocsubseclink" data-pltdoc="x">&#22810;&#20010;&#32467;&#26524;&#20540;</a></td></tr><tr><td><span class="tocsublinknumber">7.3.9<tt>&nbsp;</tt></span><a href="#%28part._contracts-no-domain%29" class="tocsubseclink" data-pltdoc="x">&#22266;&#23450;&#20294;&#38745;&#24577;&#26410;&#30693;&#25968;&#37327;</a></td></tr></table></div></div><div class="maincolumn"><div class="main"><div class="navsettop"><span class="navleft"><div class="nosearchform"></div>&nbsp;&nbsp;</span><span class="navright">&nbsp;&nbsp;<a href="contract-func.html" title="backward to &quot;7.2 函数的简单合约&quot;" data-pltdoc="x">&larr; prev</a>&nbsp;&nbsp;<a href="contracts.html" title="up to &quot;7 合约&quot;" data-pltdoc="x">up</a>&nbsp;&nbsp;<a href="contracts-first.html" title="forward to &quot;7.4 合约：一个完整的例子&quot;" data-pltdoc="x">next &rarr;</a></span>&nbsp;</div><h4>7.3<tt>&nbsp;</tt><a name="(part._contracts-general-functions)"></a>&#19968;&#33324;&#21151;&#33021;&#21512;&#32422;</h4><p><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;</span></span></span>&#21512;&#32422;&#26500;&#36896;&#22120;&#20026;&#24102;&#26377;&#19968;&#20010;&#22266;&#23450;&#25968;&#37327;&#21442;&#25968;&#30340;&#20989;&#25968;&#24037;&#20316;&#65292;&#24182;&#19988;&#36825;&#37324;&#36825;&#20010;&#32467;&#26524;&#21512;&#32422;&#19981;&#20381;&#36182;&#20110;&#36825;&#20010;&#36755;&#20837;&#21442;&#25968;&#12290;&#20026;&#20102;&#25903;&#25345;&#20854;&#23427;&#31867;&#22411;&#30340;&#20989;&#25968;&#65292;Racket&#25552;&#20379;&#39069;&#22806;&#30340;&#21512;&#32422;&#26500;&#36896;&#22120;&#65292;&#23588;&#20854;&#26159; <span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;*</span></span></span>&#21644;<span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;i</span></span></span>&#12290;</p><h5>7.3.1<tt>&nbsp;</tt><a name="(part._contracts-optional)"></a>&#21487;&#36873;&#21442;&#25968;</h5><p>&#35831;&#30475;&#19968;&#20010;&#23383;&#31526;&#20018;&#22788;&#29702;&#27169;&#22359;&#30340;&#25688;&#24405;&#65292;&#35813;&#28789;&#24863;&#26469;&#33258;&#20110;&#12298;<a href="http://schemecookbook.org">Scheme cookbook</a>&#12299;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><font class="badlink"><span class="RktModLink"><span class="RktMod">#lang</span></span></font><span class="hspace">&nbsp;</span><font class="badlink"><span class="RktModLink"><span class="RktSym">racket</span></span></font></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">provide</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">contract-out</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">&#29992;&#65288;&#21487;&#36873;&#30340;&#65289;char&#22635;&#20805;&#32473;&#23450;&#30340;&#24038;&#21491;&#20004;&#20010;str&#20197;&#20351;&#20854;&#24038;&#21491;&#23621;&#20013;</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">string-pad-center</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;*</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">string?</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">natural-number/c</span></span></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">char?</span></span></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">string?</span></span></span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">string-pad-center</span><span class="hspace">&nbsp;</span><span class="RktSym">str</span><span class="hspace">&nbsp;</span><span class="RktSym">width</span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">pad</span><span class="hspace">&nbsp;</span><span class="RktVal">#\space</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">field-width</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">min</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">width</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">string-length</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">str</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">rmargin</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">ceiling</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">/</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">width</span><span class="hspace">&nbsp;</span><span class="RktSym">field-width</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVal">2</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">lmargin</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">floor</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">/</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">width</span><span class="hspace">&nbsp;</span><span class="RktSym">field-width</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVal">2</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">string-append</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">build-string</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">lmargin</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">&#955;</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">x</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">pad</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktSym">str</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">build-string</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">rmargin</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">&#955;</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">x</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">pad</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#36825;&#20010;&#27169;&#22359;&#36755;&#20986;<span class="RktSym">string-pad-center</span>&#65292;&#19968;&#20010;&#20989;&#25968;&#65292;&#23427;&#22312;&#20013;&#24515;&#29992;&#32473;&#23450;&#23383;&#31526;&#20018;&#21019;&#24314;&#19968;&#20010;&#32473;&#23450;&#30340;<span class="RktSym">width</span>&#30340;&#19968;&#20010;&#23383;&#31526;&#20018;&#12290;&#36825;&#20010;&#40664;&#35748;&#30340;&#22635;&#20805;&#23383;&#31526;&#26159;<span class="RktVal">#\space</span>&#65307;&#22914;&#26524;&#36825;&#20010;&#23458;&#25143;&#31471;&#27169;&#22359;&#24076;&#26395;&#20351;&#29992;&#19968;&#20010;&#19981;&#21516;&#30340;&#23383;&#31526;&#65292;&#23427;&#21487;&#20197;&#29992;&#31532;&#19977;&#20010;&#21442;&#25968;&#8212;&#8212;&#19968;&#20010;&#37325;&#20889;&#40664;&#35748;&#20540;&#30340;<span class="RktSym">char</span>&#8212;&#8212;&#35843;&#29992;<span class="RktSym">string-pad-center</span>&#12290;</p><p>&#36825;&#20010;&#20989;&#25968;&#23450;&#20041;&#20351;&#29992;&#21487;&#36873;&#21442;&#25968;&#65292;&#23427;&#23545;&#20110;&#36825;&#31181;&#21151;&#33021;&#26159;&#21512;&#36866;&#30340;&#12290;&#36825;&#37324;&#26377;&#36259;&#30340;&#19968;&#28857;&#26159;<span class="RktSym">string-pad-center</span>&#30340;&#21512;&#32422;&#30340;&#34920;&#36798;&#26041;&#24335;&#12290;</p><p>&#21512;&#32422;&#32452;&#21512;&#22120;<span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;*</span></span></span>&#65292;&#35201;&#27714;&#20960;&#32452;&#21512;&#32422;&#65306;</p><ul><li><p>&#31532;&#19968;&#20010;&#26159;&#23545;&#25152;&#26377;&#24517;&#38656;&#21442;&#25968;&#30340;&#21512;&#32422;&#30340;&#19968;&#20010;&#25324;&#21495;&#32452;&#12290;&#22312;&#36825;&#20010;&#20363;&#23376;&#20013;&#65292;&#25105;&#20204;&#30475;&#21040;&#20004;&#20010;&#65306;<span class="RktSym"><span class="badlink"><span class="RktValLink">string?</span></span></span>&#21644;<span class="RktSym"><span class="badlink"><span class="RktValLink">natural-number/c</span></span></span>&#12290;</p></li><li><p>&#31532;&#20108;&#20010;&#26159;&#23545;&#25152;&#26377;&#21487;&#36873;&#21442;&#25968;&#30340;&#21512;&#32422;&#30340;&#19968;&#20010;&#25324;&#21495;&#32452;&#65306;<span class="RktSym"><span class="badlink"><span class="RktValLink">char?</span></span></span>&#12290;</p></li><li><p>&#26368;&#21518;&#19968;&#20010;&#26159;&#19968;&#20010;&#21333;&#19968;&#30340;&#21512;&#32422;&#65306;&#20989;&#25968;&#30340;&#32467;&#26524;&#12290;</p></li></ul><p>&#35831;&#27880;&#24847;&#65292;&#22914;&#26524;&#40664;&#35748;&#20540;&#19981;&#28385;&#36275;&#21512;&#32422;&#65292;&#21017;&#19981;&#20250;&#33719;&#24471;&#27492;&#25509;&#21475;&#30340;&#21512;&#32422;&#38169;&#35823;&#12290;&#22914;&#26524;&#19981;&#33021;&#20449;&#20219;&#20320;&#33258;&#24049;&#21435;&#27491;&#30830;&#33719;&#24471;&#21021;&#22987;&#20540;&#65292;&#21017;&#38656;&#35201;&#22312;&#36793;&#30028;&#19978;&#20256;&#36882;&#21021;&#22987;&#20540;&#12290;</p><h5>7.3.2<tt>&nbsp;</tt><a name="(part._contracts-rest-args)"></a>&#21097;&#20313;&#21442;&#25968;</h5><p><span class="RktSym"><span class="badlink"><span class="RktValLink">max</span></span></span>&#25805;&#20316;&#31526;&#33267;&#23569;&#25509;&#21463;&#19968;&#20010;&#23454;&#25968;&#65292;&#20294;&#23427;&#25509;&#21463;&#20219;&#24847;&#25968;&#37327;&#30340;&#38468;&#21152;&#21442;&#25968;&#12290;&#20320;&#21487;&#20197;&#20351;&#29992;&#19968;&#20010;<font class="badlink"><span class="techoutside"><span class="techinside">&#21097;&#20313;&#21442;&#25968;&#65288;rest argument&#65289;</span></span></font>&#32534;&#20889;&#20854;&#23427;&#27492;&#31867;&#20989;&#25968;&#65292;&#20363;&#22914;&#22312;<span class="RktSym">max-abs</span>&#20013;&#65306;</p><blockquote class="refpara"><blockquote class="refcolumn"><blockquote class="refcontent"><p>&#21442;&#35265;&#12298;<a href="lambda.html#%28part._rest-args%29" data-pltdoc="x">&#30003;&#26126;&#19968;&#20010;&#21097;&#20313;&#65288;rest&#65289;&#21442;&#25968;</a>&#12299;&#20197;&#33719;&#21462;&#21097;&#20313;&#21442;&#25968;&#30340;&#20171;&#32461;&#12290;</p></blockquote></blockquote></blockquote><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">max-abs</span><span class="hspace">&nbsp;</span><span class="RktSym">n</span><span class="hspace">&nbsp;</span><span class="RktPn">. </span><span class="RktSym">rst</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">foldr</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">lambda</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">n</span><span class="hspace">&nbsp;</span><span class="RktSym">m</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">max</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">abs</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">n</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">m</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">abs</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">n</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">rst</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#36890;&#36807;&#19968;&#20010;&#21512;&#32422;&#25551;&#36848;&#36825;&#20010;&#20989;&#25968;&#38656;&#35201;&#19968;&#20010;&#23545;<span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;*</span></span></span>&#36827;&#19968;&#27493;&#30340;&#25193;&#23637;&#65306;&#19968;&#20010;<span class="RktPn">#:rest</span>&#20851;&#38190;&#23383;&#22312;&#24517;&#38656;&#21442;&#25968;&#21644;&#21487;&#36873;&#21442;&#25968;&#20043;&#21518;&#25351;&#23450;&#22312;&#19968;&#20010;&#21442;&#25968;&#21015;&#34920;&#19978;&#30340;&#19968;&#20010;&#21512;&#32422;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">provide</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">contract-out</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">max-abs</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;*</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">real?</span></span></span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">#:rest</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">listof</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">real?</span></span></span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">real?</span></span></span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#27491;&#22914;&#23545;<span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;*</span></span></span>&#30340;&#36890;&#24120;&#24773;&#20917;&#65292;&#24517;&#38656;&#21442;&#25968;&#21512;&#32422;&#34987;&#23553;&#38381;&#22312;&#31532;&#19968;&#23545;&#25324;&#21495;&#20013;&#65292;&#22312;&#36825;&#31181;&#24773;&#20917;&#19979;&#26159;&#19968;&#20010;&#21333;&#19968;&#30340;&#23454;&#25968;&#12290;&#31354;&#25324;&#21495;&#34920;&#31034;&#27809;&#26377;&#21487;&#36873;&#21442;&#25968;&#65288;&#19981;&#21253;&#21547;&#21097;&#20313;&#21442;&#25968;&#65289;&#12290;&#21097;&#20313;&#21442;&#25968;&#21512;&#32422;&#36319;&#30528;<span class="RktPn">#:rest</span>&#65307;&#22240;&#20026;&#25152;&#26377;&#30340;&#39069;&#22806;&#30340;&#21442;&#25968;&#24517;&#39035;&#26159;&#23454;&#25968;&#65292;&#21097;&#20313;&#21442;&#25968;&#30340;&#21015;&#34920;&#24517;&#39035;&#28385;&#36275;&#21512;&#32422;<span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">listof</span></span></span><span class="stt"> </span><span class="RktSym"><span class="badlink"><span class="RktValLink">real?</span></span></span><span class="RktPn">)</span>&#12290;</p><h5>7.3.3<tt>&nbsp;</tt><a name="(part._contracts-keywords)"></a>&#20851;&#38190;&#23383;&#21442;&#25968;</h5><p>&#20854;&#23454;<span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;</span></span></span>&#21512;&#32422;&#26500;&#36896;&#22120;&#20063;&#21253;&#21547;&#23545;&#20851;&#38190;&#23383;&#21442;&#25968;&#30340;&#25903;&#25345;&#12290;&#20363;&#22914;&#65292;&#32771;&#34385;&#36825;&#20010;&#20989;&#25968;&#65292;&#23427;&#21019;&#24314;&#19968;&#20010;&#31616;&#21333;&#30340;GUI&#24182;&#21521;&#29992;&#25143;&#35810;&#38382;&#19968;&#20010;yes-or-no&#30340;&#38382;&#39064;&#65306;</p><blockquote class="refpara"><blockquote class="refcolumn"><blockquote class="refcontent"><p>&#21442;&#35265;&#12298;<a href="lambda.html#%28part._lambda-keywords%29" data-pltdoc="x">&#22768;&#26126;&#20851;&#38190;&#23383;&#65288;keyword&#65289;&#21442;&#25968;</a>&#12299;&#20197;&#33719;&#21462;&#20851;&#38190;&#23383;&#21442;&#25968;&#30340;&#20171;&#32461;&#12290;</p></blockquote></blockquote></blockquote><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><font class="badlink"><span class="RktModLink"><span class="RktMod">#lang</span></span></font><span class="hspace">&nbsp;</span><font class="badlink"><span class="RktModLink"><span class="RktSym">racket/gui</span></span></font></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">ask-yes-or-no-question</span><span class="hspace">&nbsp;</span><span class="RktSym">question</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">#:default</span><span class="hspace">&nbsp;</span><span class="RktSym">answer</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">#:title</span><span class="hspace">&nbsp;</span><span class="RktSym">title</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">#:width</span><span class="hspace">&nbsp;</span><span class="RktSym">w</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">#:height</span><span class="hspace">&nbsp;</span><span class="RktSym">h</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">d</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">new</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">dialog%</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">label</span><span class="hspace">&nbsp;</span><span class="RktSym">title</span><span class="RktPn">]</span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">width</span><span class="hspace">&nbsp;</span><span class="RktSym">w</span><span class="RktPn">]</span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">height</span><span class="hspace">&nbsp;</span><span class="RktSym">h</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">msg</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">new</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">message%</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">label</span><span class="hspace">&nbsp;</span><span class="RktSym">question</span><span class="RktPn">]</span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">parent</span><span class="hspace">&nbsp;</span><span class="RktSym">d</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">yes</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">set!</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">answer</span><span class="hspace">&nbsp;</span><span class="RktVal">#t</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">d</span><span class="hspace">&nbsp;</span><span class="RktSym">show</span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">no</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">set!</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">answer</span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">d</span><span class="hspace">&nbsp;</span><span class="RktSym">show</span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">yes-b</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">new</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">button%</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">label</span><span class="hspace">&nbsp;</span><span class="RktVal">"Yes"</span><span class="RktPn">]</span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">parent</span><span class="hspace">&nbsp;</span><span class="RktSym">d</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">callback</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">&#955;</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">x</span><span class="hspace">&nbsp;</span><span class="RktSym">y</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">yes</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">style</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">if</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">answer</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">border</span><span class="RktVal">)</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">)</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">no-b</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">new</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">button%</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">label</span><span class="hspace">&nbsp;</span><span class="RktVal">"No"</span><span class="RktPn">]</span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">parent</span><span class="hspace">&nbsp;</span><span class="RktSym">d</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">callback</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">&#955;</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">x</span><span class="hspace">&nbsp;</span><span class="RktSym">y</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">no</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">style</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">if</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">answer</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">)</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">border</span><span class="RktVal">)</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">d</span><span class="hspace">&nbsp;</span><span class="RktSym">show</span><span class="hspace">&nbsp;</span><span class="RktVal">#t</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktSym">answer</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">provide</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">contract-out</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">ask-yes-or-no-question</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">string?</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">#:default</span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">boolean?</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">#:title</span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">string?</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">#:width</span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">exact-integer?</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">#:height</span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">exact-integer?</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">boolean?</span></span></span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><blockquote class="refpara"><blockquote class="refcolumn"><blockquote class="refcontent"><p>&#22914;&#26524;&#20320;&#30495;&#30340;&#24819;&#36890;&#36807;&#19968;&#20010;GUI&#38382;&#19968;&#20010;yes&#25110;no&#30340;&#38382;&#39064;&#65292;&#20320;&#24212;&#35813;&#20351;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">message-box/custom</span></span></span>&#12290;&#23545;&#27492;&#20107;&#32780;&#35770;&#65292;&#36890;&#24120;&#20250;&#27604;&#29992;&#36739;&#8220;yes&#8221;&#25110;&#8220;no&#8221;&#26356;&#30830;&#20999;&#30340;&#22238;&#31572;&#26469;&#25552;&#20379;&#25353;&#38062;&#26356;&#22909;&#12290;</p></blockquote></blockquote></blockquote><p><span class="RktSym">ask-yes-or-no-question</span>&#30340;&#21512;&#32422;&#20351;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;</span></span></span>&#65292;&#21516;&#26679;&#30340;&#26041;&#24335;<span class="RktSym"><span class="badlink"><span class="RktValLink">lambda</span></span></span>&#65288;&#25110;&#22522;&#20110;<span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span>&#30340;&#20989;&#25968;&#65289;&#20801;&#35768;&#19968;&#20010;&#20851;&#38190;&#23383;&#20808;&#20110;&#19968;&#20010;&#20989;&#25968;&#27491;&#24335;&#30340;&#21442;&#25968;&#65292;<span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;</span></span></span>&#20801;&#35768;&#19968;&#20010;&#20851;&#38190;&#23383;&#20808;&#20110;&#19968;&#20010;&#20989;&#25968;&#21512;&#32422;&#30340;&#21442;&#25968;&#21512;&#32422;&#12290;&#22312;&#36825;&#31181;&#24773;&#20917;&#19979;&#65292;&#36825;&#20010;&#21512;&#32422;&#34920;&#26126;<span class="RktSym">ask-yes-or-no-question</span>&#24517;&#39035;&#25509;&#25910;&#22235;&#20010;&#20851;&#38190;&#23383;&#21442;&#25968;&#65292;&#27599;&#19968;&#20010;&#20851;&#38190;&#23383;&#20026;&#65306;<span class="RktPn">#:default</span>&#12289;<span class="RktPn">#:title</span>&#12289;<span class="RktPn">#:width</span>&#21644;<span class="RktPn">#:height</span>&#12290;&#22914;&#21516;&#22312;&#19968;&#20010;&#20989;&#25968;&#23450;&#20041;&#20013;&#65292;&#22312;<span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;</span></span></span>&#20013;&#20851;&#38190;&#23383;&#30340;&#39034;&#24207;&#30456;&#23545;&#20110;&#20854;&#23427;&#30340;&#27599;&#20010;&#26469;&#35828;&#23545;&#20989;&#25968;&#30340;&#23458;&#25143;&#31471;&#26080;&#20851;&#32039;&#35201;&#65307;&#21482;&#26377;&#21442;&#25968;&#21512;&#32422;&#30340;&#30456;&#23545;&#39034;&#24207;&#27809;&#26377;&#20851;&#38190;&#23383;&#38382;&#39064;&#12290;</p><h5>7.3.4<tt>&nbsp;</tt><a name="(part._contracts-optional-keywords)"></a>&#21487;&#36873;&#20851;&#38190;&#23383;&#21442;&#25968;</h5><p>&#24403;&#28982;&#65292;<span class="RktSym">ask-yes-or-no-question</span>&#65288;&#20174;&#19978;&#19968;&#20010;&#38382;&#39064;&#20013;&#24341;&#26469;&#65289;&#20013;&#26377;&#35768;&#22810;&#21442;&#25968;&#26377;&#21512;&#29702;&#30340;&#40664;&#35748;&#20540;&#24182;&#19988;&#24212;&#35813;&#34987;&#35774;&#20026;&#21487;&#36873;&#30340;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">ask-yes-or-no-question</span><span class="hspace">&nbsp;</span><span class="RktSym">question</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">#:default</span><span class="hspace">&nbsp;</span><span class="RktSym">answer</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">#:title</span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">title</span><span class="hspace">&nbsp;</span><span class="RktVal">"Yes or No?"</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">#:width</span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">w</span><span class="hspace">&nbsp;</span><span class="RktVal">400</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">#:height</span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">h</span><span class="hspace">&nbsp;</span><span class="RktVal">200</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">...</span></span></span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#35201;&#25351;&#23450;&#36825;&#20010;&#20989;&#25968;&#30340;&#21512;&#32422;&#65292;&#25105;&#20204;&#38656;&#35201;&#20877;&#27425;&#20351;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;*</span></span></span>&#12290;&#23427;&#25903;&#25345;&#20851;&#38190;&#23383;&#65292;&#27491;&#22914;&#20320;&#22312;&#21487;&#36873;&#21442;&#25968;&#21644;&#24378;&#21046;&#21442;&#25968;&#37096;&#20998;&#20013;&#25152;&#26399;&#26395;&#30340;&#19968;&#26679;&#12290;&#22312;&#36825;&#31181;&#24773;&#20917;&#19979;&#65292;&#25105;&#20204;&#26377;&#24378;&#21046;&#20851;&#38190;&#23383;<span class="RktPn">#:default</span>&#21644;&#21487;&#36873;&#20851;&#38190;&#23383;<span class="RktPn">#:title</span>&#12289;<span class="RktPn">#:width</span>&#21644;<span class="RktPn">#:height</span>&#12290;&#25152;&#20197;&#65292;&#25105;&#20204;&#20687;&#36825;&#26679;&#32534;&#20889;&#21512;&#32422;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">provide</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">contract-out</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">ask-yes-or-no-question</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;*</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">string?</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">#:default</span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">boolean?</span></span></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktPn">#:title</span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">string?</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">#:width</span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">exact-integer?</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">#:height</span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">exact-integer?</span></span></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">boolean?</span></span></span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#20063;&#23601;&#26159;&#35828;&#65292;&#25105;&#20204;&#25226;&#24378;&#21046;&#20851;&#38190;&#23383;&#26041;&#22312;&#31532;&#19968;&#37096;&#20998;&#20013;&#65292;&#21516;&#26102;&#25105;&#20204;&#25226;&#21487;&#36873;&#20851;&#38190;&#23383;&#25918;&#22312;&#22312;&#31532;&#20108;&#37096;&#20998;&#20013;&#12290;</p><h5>7.3.5<tt>&nbsp;</tt><a name="(part._contracts-case-lambda)"></a><span class="RktSym"><span class="badlink"><span class="RktValLink">case-lambda</span></span></span>&#30340;&#21512;&#32422;</h5><p>&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">case-lambda</span></span></span>&#23450;&#20041;&#30340;&#19968;&#20010;&#20989;&#25968;&#21487;&#20197;&#23545;&#20854;&#21442;&#25968;&#26045;&#21152;&#19981;&#21516;&#30340;&#32422;&#26463;&#21462;&#20915;&#20110;&#22810;&#23569;&#21442;&#25968;&#34987;&#25552;&#20379;&#12290;&#20363;&#22914;&#65292;<span class="RktSym">report-cost</span>&#20989;&#25968;&#21487;&#20197;&#26082;&#21487;&#20197;&#36716;&#25442;&#19968;&#23545;&#25968;&#20540;&#20063;&#21487;&#20197;&#36716;&#25442;&#19968;&#20010;&#23383;&#31526;&#20018;&#20026;&#19968;&#20010;&#26032;&#23383;&#31526;&#20018;&#65306;</p><blockquote class="refpara"><blockquote class="refcolumn"><blockquote class="refcontent"><p>&#21442;&#35265;&#12298;<a href="lambda.html#%28part._case-lambda%29" data-pltdoc="x">&#23454;&#21442;&#25968;&#37327;&#24863;&#30693;&#20989;&#25968;&#65306;case-lambda</a>&#12299;&#20197;&#33719;&#24471;<span class="RktSym"><span class="badlink"><span class="RktValLink">case-lambda</span></span></span>&#30340;&#20171;&#32461;&#12290;</p></blockquote></blockquote></blockquote><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">report-cost</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">case-lambda</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym">lo</span><span class="hspace">&nbsp;</span><span class="RktSym">hi</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">format</span></span></span><span class="hspace">&nbsp;</span><span class="RktVal">"between $~a and $~a"</span><span class="hspace">&nbsp;</span><span class="RktSym">lo</span><span class="hspace">&nbsp;</span><span class="RktSym">hi</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym">desc</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">format</span></span></span><span class="hspace">&nbsp;</span><span class="RktVal">"~a of dollars"</span><span class="hspace">&nbsp;</span><span class="RktSym">desc</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p>&nbsp;</p></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">report-cost</span><span class="hspace">&nbsp;</span><span class="RktVal">5</span><span class="hspace">&nbsp;</span><span class="RktVal">8</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">"between $5 and $8"</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">report-cost</span><span class="hspace">&nbsp;</span><span class="RktVal">"millions"</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">"millions of dollars"</span></p></td></tr></table></td></tr></table></blockquote><p>&#23545;&#36825;&#26679;&#30340;&#19968;&#20010;&#20989;&#25968;&#30340;&#21512;&#32422;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">case-&gt;</span></span></span>&#32452;&#21512;&#22120;&#26500;&#25104;&#65292;&#23427;&#26681;&#25454;&#38656;&#35201;&#32452;&#21512;&#22810;&#20010;&#21151;&#33021;&#21512;&#32422;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">provide</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">contract-out</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">report-cost</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">case-&gt;</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">integer?</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">integer?</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">. </span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;</span></span></span><span class="RktPn"> .</span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">string?</span></span></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">string?</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">. </span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;</span></span></span><span class="RktPn"> .</span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">string?</span></span></span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#22914;&#20320;&#25152;&#35265;&#65292;<span class="RktSym">report-cost</span>&#30340;&#21512;&#32422;&#32452;&#21512;&#20102;&#20004;&#20010;&#20989;&#25968;&#21512;&#32422;&#65292;&#23427;&#19982;&#20854;&#21151;&#33021;&#25152;&#38656;&#30340;&#35299;&#37322;&#19968;&#26679;&#22810;&#30340;&#20174;&#21477;&#12290;</p><h5>7.3.6<tt>&nbsp;</tt><a name="(part._contracts-arrow-d)"></a>&#21442;&#25968;&#21644;&#32467;&#26524;&#20381;&#36182;</h5><p>&#20197;&#19979;&#26159;&#26469;&#33258;&#19968;&#20010;&#34394;&#26500;&#30340;&#25968;&#20540;&#27169;&#22359;&#30340;&#19968;&#20010;&#25688;&#24405;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">provide</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">contract-out</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">real-sqrt</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;i</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">argument</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">&gt;=/c</span></span></span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">result</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">argument</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">&lt;=/c</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">argument</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><blockquote class="refpara"><blockquote class="refcolumn"><blockquote class="refcontent"><p>&#36825;&#20010;&#35789;&#8220;indy&#8221;&#24847;&#21619;&#30528;&#26263;&#31034;&#24402;&#21646;&#20250;&#34987;&#20998;&#37197;&#21040;&#21512;&#32422;&#26412;&#36523;&#65292;&#22240;&#20026;&#36825;&#20010;&#21512;&#32422;&#24517;&#39035;&#34987;&#35748;&#20026;&#26159;&#19968;&#20010;&#29420;&#31435;&#30340;&#32452;&#20214;&#12290;&#21709;&#24212;&#20004;&#20010;&#29616;&#26377;&#26631;&#31614;&#36873;&#25321;&#21517;&#31216;&#8212;&#8212;&#8220;lax&#8221;&#21644;&#8220;picky&#8221;&#8212;&#8212;&#20026;&#22312;&#30740;&#31350;&#25991;&#29486;&#20013;&#30340;&#20989;&#25968;&#21512;&#32422;&#30340;&#19981;&#21516;&#35821;&#20041;&#12290;</p></blockquote></blockquote></blockquote><p>&#36825;&#20010;&#36755;&#20986;&#20989;&#25968;<span class="RktSym">real-sqrt</span>&#30340;&#21512;&#32422;&#20351;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;i</span></span></span>&#27604;&#20351;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;*</span></span></span>&#26356;&#22909;&#12290;&#36825;&#20010;&#8220;i&#8221;&#20195;&#34920;&#26159;&#19968;&#20010;<span style="font-style: italic">&#21360;&#22320;&#20381;&#36182;&#65288;indy dependent&#65289;</span>&#21512;&#32422;&#65292;&#24847;&#21619;&#20989;&#25968;&#20540;&#22495;&#30340;&#21512;&#32422;&#20381;&#36182;&#20110;&#35813;&#21442;&#25968;&#30340;&#20540;&#12290;&#22312;<span class="RktSym">result</span>&#30340;&#21512;&#32422;&#36825;&#19968;&#34892;&#37324;<span class="RktSym">argument</span>&#30340;&#20986;&#29616;&#24847;&#21619;&#30528;&#37027;&#20010;&#32467;&#26524;&#20381;&#36182;&#20110;&#36825;&#20010;&#21442;&#25968;&#12290;&#22312;&#29305;&#21035;&#24773;&#20917;&#19979;&#65292;<span class="RktSym">real-sqrt</span>&#30340;&#21442;&#25968;&#22823;&#20110;&#25110;&#31561;&#20110;1&#65292;&#25152;&#20197;&#19968;&#20010;&#24456;&#22522;&#26412;&#30340;&#27491;&#30830;&#24615;&#26816;&#26597;&#26159;&#32467;&#26524;&#23567;&#20110;&#21442;&#25968;&#12290;</p><p>&#19968;&#33324;&#26469;&#35828;&#65292;&#19968;&#20010;&#20381;&#36182;&#20989;&#25968;&#21512;&#32422;&#30475;&#36215;&#26469;&#26356;&#20687;&#19968;&#33324;&#30340;<span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;*</span></span></span>&#21512;&#32422;&#65292;&#20294;&#26159;&#22312;&#21512;&#32422;&#30340;&#20854;&#23427;&#22320;&#26041;&#21487;&#20197;&#20351;&#29992;&#21517;&#23383;&#12290;</p><p>&#22238;&#21040;&#38134;&#34892;&#24080;&#25143;&#31034;&#20363;&#65292;&#20551;&#35774;&#25105;&#20204;&#19968;&#33324;&#21270;&#36825;&#20010;&#27169;&#22359;&#20197;&#25903;&#25345;&#22810;&#20010;&#24080;&#25143;&#24182;&#19988;&#25105;&#20204;&#20063;&#21253;&#25324;&#19968;&#20010;&#21462;&#27454;&#25805;&#20316;&#12290;
&#25913;&#36827;&#21518;&#30340;&#38134;&#34892;&#24080;&#25143;&#27169;&#22359;&#21253;&#25324;&#19968;&#20010;<span class="RktSym">account</span>&#32467;&#26500;&#31867;&#22411;&#21644;&#20197;&#19979;&#20989;&#25968;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">provide</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">contract-out</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">balance</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">account?</span><span class="hspace">&nbsp;</span><span class="RktSym">amount/c</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">withdraw</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">account?</span><span class="hspace">&nbsp;</span><span class="RktSym">amount/c</span><span class="hspace">&nbsp;</span><span class="RktSym">account?</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">deposit</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">account?</span><span class="hspace">&nbsp;</span><span class="RktSym">amount/c</span><span class="hspace">&nbsp;</span><span class="RktSym">account?</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#20294;&#26159;&#65292;&#38500;&#20102;&#35201;&#27714;&#19968;&#20010;&#23458;&#25143;&#31471;&#20026;&#19968;&#20010;&#21462;&#27454;&#25552;&#20379;&#19968;&#20010;&#26377;&#25928;&#37329;&#39069;&#22806;&#65292;&#37329;&#39069;&#24212;&#23567;&#20110;&#25110;&#31561;&#20110;&#25351;&#23450;&#36134;&#25143;&#30340;&#20313;&#39069;&#65292;&#24182;&#19988;&#32467;&#26524;&#36134;&#25143;&#20250;&#27604;&#23427;&#24320;&#22987;&#26102;&#30340;&#38065;&#23569;&#12290;&#21516;&#26679;&#65292;&#35813;&#27169;&#22359;&#21487;&#33021;&#25215;&#35834;&#19968;&#20010;&#23384;&#27454;&#36890;&#36807;&#20026;&#36134;&#25143;&#22686;&#21152;&#38065;&#26469;&#20135;&#29983;&#19968;&#20010;&#24080;&#25143;&#12290;&#20197;&#19979;&#23454;&#29616;&#36890;&#36807;&#21512;&#32422;&#24378;&#21046;&#25191;&#34892;&#36825;&#20123;&#32422;&#26463;&#21644;&#20445;&#35777;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><font class="badlink"><span class="RktModLink"><span class="RktMod">#lang</span></span></font><span class="hspace">&nbsp;</span><font class="badlink"><span class="RktModLink"><span class="RktSym">racket</span></span></font></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">&#31532;1&#37096;&#20998;&#65306;&#21512;&#32422;&#23450;&#20041;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">account</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">balance</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">amount/c</span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">natural-number/c</span></span></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">&#31532;2&#37096;&#20998;&#65306;&#36755;&#20986;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">provide</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">contract-out</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">create</span><span class="hspace">&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">amount/c</span><span class="hspace">&nbsp;</span><span class="RktPn">. </span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;</span></span></span><span class="RktPn"> .</span><span class="hspace">&nbsp;</span><span class="RktSym">account?</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">balance</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">account?</span><span class="hspace">&nbsp;</span><span class="RktPn">. </span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;</span></span></span><span class="RktPn"> .</span><span class="hspace">&nbsp;</span><span class="RktSym">amount/c</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">withdraw</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;i</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">acc</span><span class="hspace">&nbsp;</span><span class="RktSym">account?</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">amt</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">acc</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">and/c</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">amount/c</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">&lt;=/c</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">balance</span><span class="hspace">&nbsp;</span><span class="RktSym">acc</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">result</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">acc</span><span class="hspace">&nbsp;</span><span class="RktSym">amt</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">and/c</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">account?</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">lambda</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">res</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">&gt;=</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">balance</span><span class="hspace">&nbsp;</span><span class="RktSym">res</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">balance</span><span class="hspace">&nbsp;</span><span class="RktSym">acc</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">amt</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">deposit</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;i</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">acc</span><span class="hspace">&nbsp;</span><span class="RktSym">account?</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">amt</span><span class="hspace">&nbsp;</span><span class="RktSym">amount/c</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">result</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">acc</span><span class="hspace">&nbsp;</span><span class="RktSym">amt</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">and/c</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">account?</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">lambda</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">res</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">&gt;=</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">balance</span><span class="hspace">&nbsp;</span><span class="RktSym">res</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">+</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">balance</span><span class="hspace">&nbsp;</span><span class="RktSym">acc</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">amt</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">&#31532;3&#37096;&#20998;&#65306;&#20989;&#25968;&#23450;&#20041;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">balance</span><span class="hspace">&nbsp;</span><span class="RktSym">account-balance</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">create</span><span class="hspace">&nbsp;</span><span class="RktSym">amt</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">account</span><span class="hspace">&nbsp;</span><span class="RktSym">amt</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">withdraw</span><span class="hspace">&nbsp;</span><span class="RktSym">a</span><span class="hspace">&nbsp;</span><span class="RktSym">amt</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">account</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">account-balance</span><span class="hspace">&nbsp;</span><span class="RktSym">a</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">amt</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">deposit</span><span class="hspace">&nbsp;</span><span class="RktSym">a</span><span class="hspace">&nbsp;</span><span class="RktSym">amt</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">account</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">+</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">account-balance</span><span class="hspace">&nbsp;</span><span class="RktSym">a</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">amt</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#22312;&#31532;2&#37096;&#20998;&#20013;&#36825;&#20010;&#21512;&#32422;&#20026;<span class="RktSym">create</span>&#21644;<span class="RktSym">balance</span>&#25552;&#20379;&#20102;&#20856;&#22411;&#30340;&#31867;&#22411;&#20445;&#35777;&#12290;&#28982;&#32780;&#65292;&#23545;&#20110;<span class="RktSym">withdraw</span>&#21644;<span class="RktSym">deposit</span>&#65292;&#35813;&#21512;&#32422;&#26816;&#26597;&#24182;&#20445;&#35777;&#23545;<span class="RktSym">balance</span>&#21644;<span class="RktSym">deposit</span>&#30340;&#26356;&#20026;&#22797;&#26434;&#30340;&#32422;&#26463;&#12290;&#22312;&#23545;<span class="RktSym">withdraw</span>&#30340;&#21512;&#32422;&#19978;&#30340;&#31532;&#20108;&#20010;&#21442;&#25968;&#20351;&#29992;<span class="RktPn">(</span><span class="RktSym">balance</span><span class="stt"> </span><span class="RktSym">acc</span><span class="RktPn">)</span>&#26469;&#26816;&#26597;&#25152;&#25552;&#20379;&#30340;&#21462;&#27454;&#37329;&#39069;&#26159;&#21542;&#36275;&#22815;&#23567;&#65292;&#20854;&#20013;<span class="RktSym">acc</span>&#26159;&#22312;<span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;i</span></span></span>&#20043;&#20013;&#32473;&#23450;&#30340;&#20989;&#25968;&#31532;&#19968;&#20010;&#21442;&#25968;&#30340;&#21517;&#31216;&#12290;&#22312;<span class="RktSym">withdraw</span>&#32467;&#26524;&#19978;&#30340;&#21512;&#32422;&#20351;&#29992;<span class="RktSym">acc</span>&#21644;<span class="RktSym">amt</span>&#26469;&#20445;&#35777;&#19981;&#36229;&#36807;&#25152;&#35201;&#27714;&#30340;&#37329;&#39069;&#34987;&#25552;&#21462;&#12290;&#22312;<span class="RktSym">deposit</span>&#19978;&#30340;&#21512;&#32422;&#21516;&#26679;&#22312;&#32467;&#26524;&#21512;&#32422;&#20013;&#20351;&#29992;<span class="RktSym">acc</span>&#21644;<span class="RktSym">amount</span>&#26469;&#20445;&#35777;&#33267;&#23569;&#21644;&#25552;&#20379;&#30340;&#19968;&#26679;&#22810;&#30340;&#38065;&#34987;&#23384;&#20837;&#36134;&#25143;&#12290;</p><p>&#27491;&#22914;&#19978;&#38754;&#25152;&#32534;&#20889;&#30340;&#65292;&#24403;&#19968;&#20010;&#21512;&#32422;&#26816;&#26597;&#22833;&#36133;&#26102;&#65292;&#35813;&#38169;&#35823;&#28040;&#24687;&#19981;&#26159;&#24456;&#26174;&#33879;&#12290;&#19979;&#38754;&#30340;&#20462;&#35746;&#22312;&#19968;&#20010;&#21161;&#25163;&#20989;&#25968;<span class="RktSym">mk-account-contract</span>&#20013;&#20351;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">flat-named-contract</span></span></span>&#20197;&#25552;&#20379;&#26356;&#22909;&#30340;&#38169;&#35823;&#28040;&#24687;&#12290;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><font class="badlink"><span class="RktModLink"><span class="RktMod">#lang</span></span></font><span class="hspace">&nbsp;</span><font class="badlink"><span class="RktModLink"><span class="RktSym">racket</span></span></font></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">&#31532;1&#37096;&#20998;&#65306;&#21512;&#32422;&#23450;&#20041;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">struct</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">account</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">balance</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">amount/c</span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">natural-number/c</span></span></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">msg&gt;</span><span class="hspace">&nbsp;</span><span class="RktVal">"account a with balance larger than ~a expected"</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">msg&lt;</span><span class="hspace">&nbsp;</span><span class="RktVal">"account a with balance less than ~a expected"</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">mk-account-contract</span><span class="hspace">&nbsp;</span><span class="RktSym">acc</span><span class="hspace">&nbsp;</span><span class="RktSym">amt</span><span class="hspace">&nbsp;</span><span class="RktSym">op</span><span class="hspace">&nbsp;</span><span class="RktSym">msg</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">balance0</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">balance</span><span class="hspace">&nbsp;</span><span class="RktSym">acc</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">ctr</span><span class="hspace">&nbsp;</span><span class="RktSym">a</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">and</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">account?</span><span class="hspace">&nbsp;</span><span class="RktSym">a</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">op</span><span class="hspace">&nbsp;</span><span class="RktSym">balance0</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">balance</span><span class="hspace">&nbsp;</span><span class="RktSym">a</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">flat-named-contract</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">format</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">msg</span><span class="hspace">&nbsp;</span><span class="RktSym">balance0</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">ctr</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">&#31532;2&#37096;&#20998;&#65306;&#23548;&#20986;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">provide</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">contract-out</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">create</span><span class="hspace">&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">amount/c</span><span class="hspace">&nbsp;</span><span class="RktPn">. </span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;</span></span></span><span class="RktPn"> .</span><span class="hspace">&nbsp;</span><span class="RktSym">account?</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">balance</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">account?</span><span class="hspace">&nbsp;</span><span class="RktPn">. </span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;</span></span></span><span class="RktPn"> .</span><span class="hspace">&nbsp;</span><span class="RktSym">amount/c</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">withdraw</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;i</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">acc</span><span class="hspace">&nbsp;</span><span class="RktSym">account?</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">amt</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">acc</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">and/c</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">amount/c</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">&lt;=/c</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">balance</span><span class="hspace">&nbsp;</span><span class="RktSym">acc</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">result</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">acc</span><span class="hspace">&nbsp;</span><span class="RktSym">amt</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">mk-account-contract</span><span class="hspace">&nbsp;</span><span class="RktSym">acc</span><span class="hspace">&nbsp;</span><span class="RktSym">amt</span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">&gt;=</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">msg&gt;</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">deposit</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;i</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">acc</span><span class="hspace">&nbsp;</span><span class="RktSym">account?</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">amt</span><span class="hspace">&nbsp;</span><span class="RktSym">amount/c</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">result</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">acc</span><span class="hspace">&nbsp;</span><span class="RktSym">amt</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">mk-account-contract</span><span class="hspace">&nbsp;</span><span class="RktSym">acc</span><span class="hspace">&nbsp;</span><span class="RktSym">amt</span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">&lt;=</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">msg&lt;</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">&#31532;3&#37096;&#20998;&#65306;&#20989;&#25968;&#23450;&#20041;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">balance</span><span class="hspace">&nbsp;</span><span class="RktSym">account-balance</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">create</span><span class="hspace">&nbsp;</span><span class="RktSym">amt</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">account</span><span class="hspace">&nbsp;</span><span class="RktSym">amt</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">withdraw</span><span class="hspace">&nbsp;</span><span class="RktSym">a</span><span class="hspace">&nbsp;</span><span class="RktSym">amt</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">account</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">account-balance</span><span class="hspace">&nbsp;</span><span class="RktSym">a</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">amt</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">deposit</span><span class="hspace">&nbsp;</span><span class="RktSym">a</span><span class="hspace">&nbsp;</span><span class="RktSym">amt</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">account</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">+</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">account-balance</span><span class="hspace">&nbsp;</span><span class="RktSym">a</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">amt</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><h5>7.3.7<tt>&nbsp;</tt><a name="(part._contracts-arrow-d-eval-order)"></a>&#26816;&#26597;&#29366;&#24577;&#21464;&#21270;</h5><p><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;i</span></span></span>&#21512;&#32422;&#32452;&#21512;&#22120;&#20063;&#21487;&#20197;&#30830;&#20445;&#19968;&#20010;&#20989;&#25968;&#20165;&#25353;&#29031;&#19968;&#23450;&#30340;&#32422;&#26463;&#20462;&#25913;&#29366;&#24577;&#12290;&#20363;&#22914;&#65292;&#32771;&#34385;&#36825;&#20010;&#21512;&#32422;&#65288;&#23427;&#26159;&#26469;&#33258;&#26694;&#26550;&#20013;&#30340;&#20989;&#25968;<span class="RktSym"><span class="badlink"><span class="RktValLink">preferences:add-panel</span></span></span>&#30340;&#19968;&#20010;&#30053;&#24494;&#31616;&#21270;&#30340;&#29256;&#26412;&#65289;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;i</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">parent</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">is-a?/c</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">area-container-window&lt;%&gt;</span></span></span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym"><span class="badlink"><span class="RktValLink">_</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">parent</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">let</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">old-children</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">parent</span><span class="hspace">&nbsp;</span><span class="RktSym">get-children</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">&#955;</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">child</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">andmap</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">eq?</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">append</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">old-children</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">list</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">child</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">send</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">parent</span><span class="hspace">&nbsp;</span><span class="RktSym">get-children</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#23427;&#34920;&#31034;&#35813;&#20989;&#25968;&#25509;&#21463;&#19968;&#20010;&#34987;&#21629;&#21517;&#20026;<span class="RktSym">parent</span>&#30340;&#21333;&#19968;&#21442;&#25968;&#65292;&#24182;&#19988;<span class="RktSym">parent</span>&#24517;&#39035;&#26159;&#19968;&#20010;&#21305;&#37197;&#36825;&#20010;&#25509;&#21475;<span class="RktSym"><span class="badlink"><span class="RktValLink">area-container-window&lt;%&gt;</span></span></span>&#30340;&#23545;&#35937;&#12290;</p><p>&#36825;&#20010;&#20540;&#22495;&#21512;&#32422;&#30830;&#20445;&#35813;&#20989;&#25968;&#36890;&#36807;&#28155;&#21152;&#19968;&#20010;&#26032;&#30340;child&#21040;&#21015;&#34920;&#30340;&#21069;&#38754;&#26469;&#20165;&#20165;&#20462;&#25913;<span class="RktSym">parent</span>&#30340;children&#12290;&#23427;&#36890;&#36807;&#20351;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">_</span></span></span>&#20195;&#26367;&#19968;&#20010;&#27491;&#24120;&#30340;&#26631;&#35782;&#31526;&#26469;&#23436;&#25104;&#36825;&#20010;&#65292;&#23427;&#21578;&#35785;&#36825;&#20010;&#21512;&#32422;&#24211;&#35813;&#20540;&#22495;&#21512;&#32422;&#24182;&#19981;&#20381;&#36182;&#20110;&#20219;&#20309;&#32467;&#26524;&#30340;&#20540;&#65292;&#22240;&#27492;&#24403;&#36825;&#20010;&#20989;&#25968;&#34987;&#35843;&#29992;&#26102;&#65292;&#32780;&#19981;&#26159;&#36820;&#22238;&#26102;&#65292;&#35813;&#21512;&#32422;&#24211;&#27714;&#20540;&#36825;&#20010;&#36319;&#30528;<span class="RktSym"><span class="badlink"><span class="RktValLink">_</span></span></span>&#30340;&#34920;&#36798;&#24335;&#12290;&#22240;&#27492;&#23545;<span class="RktSym">get-children</span>&#26041;&#27861;&#30340;&#35843;&#29992;&#21457;&#29983;&#22312;&#21512;&#32422;&#34987;&#35843;&#29992;&#19979;&#30340;&#20989;&#25968;&#20043;&#21069;&#12290;&#24403;&#21512;&#32422;&#19979;&#30340;&#20989;&#25968;&#36820;&#22238;&#26102;&#65292;&#23427;&#30340;&#32467;&#26524;&#20316;&#20026;<span class="RktSym">child</span>&#34987;&#20256;&#36882;&#36827;&#21435;&#65292;&#24182;&#19988;&#21512;&#32422;&#30830;&#20445;&#35813;&#20989;&#25968;&#36820;&#22238;&#21518;&#30340;child&#19982;&#35813;&#20989;&#25968;&#35843;&#29992;&#20043;&#21069;&#30340;child&#30456;&#21516;&#65292;&#20294;&#26159;&#26377;&#35768;&#35768;&#22810;&#22810;&#30340;child&#65292;&#22312;&#21015;&#34920;&#21069;&#38754;&#12290;</p><p>&#35201;&#21435;&#26126;&#30333;&#22312;&#19968;&#20010;&#38598;&#20013;&#22312;&#36825;&#28857;&#19978;&#30340;&#29609;&#20855;&#20363;&#23376;&#20013;&#30340;&#19981;&#21516;&#65292;&#32771;&#34385;&#36825;&#20010;&#31243;&#24207;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><font class="badlink"><span class="RktModLink"><span class="RktMod">#lang</span></span></font><span class="hspace">&nbsp;</span><font class="badlink"><span class="RktModLink"><span class="RktSym">racket</span></span></font></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">get-x</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">f</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">set!</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">cons</span></span></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">f</span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">provide</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">contract-out</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">f</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;i</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym"><span class="badlink"><span class="RktValLink">_</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">begin</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">set!</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">cons</span></span></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">ctc</span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">any/c</span></span></span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">get-x</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">listof</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">symbol?</span></span></span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#22914;&#26524;&#20320;&#23558;&#38656;&#35201;&#36825;&#20010;&#27169;&#22359;&#65292;&#35843;&#29992;<span class="RktSym">f</span>&#65292;&#37027;&#20040;<span class="RktSym">get-x</span>&#30340;&#32467;&#26524;&#20250;&#26159;<span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">f</span><span class="stt"> </span><span class="RktVal">ctc</span><span class="RktVal">)</span>&#12290;&#30456;&#21453;&#65292;&#22914;&#26524;<span class="RktSym">f</span>&#30340;&#21512;&#32422;&#26159;</p><blockquote class="SCodeFlow"><p><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;i</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">res</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">begin</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">set!</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">cons</span></span></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">ctc</span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">any/c</span></span></span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span></p></blockquote><p>&#65288;&#21482;&#25913;&#21464;<span class="RktSym">res</span>&#30340;&#19979;&#21010;&#32447;&#65289;&#65292;&#37027;&#20040;<span class="RktSym">get-x</span>&#30340;&#32467;&#26524;&#20250;&#26159;<span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">ctc</span><span class="stt"> </span><span class="RktVal">f</span><span class="RktVal">)</span>&#12290;</p><h5>7.3.8<tt>&nbsp;</tt><a name="(part._contracts-multiple)"></a>&#22810;&#20010;&#32467;&#26524;&#20540;</h5><p>&#20989;&#25968;<span class="RktSym">split</span>&#25509;&#21463;<span class="RktSym">char</span>&#30340;&#19968;&#20010;&#21015;&#34920;&#24182;&#19988;&#20256;&#36882;&#22312;<span class="RktVal">#\newline</span>&#65288;&#22914;&#26524;&#26377;&#65289;&#30340;&#31532;&#19968;&#27425;&#20986;&#29616;&#20043;&#21069;&#30340;&#23383;&#31526;&#20018;&#20197;&#21450;&#36825;&#20010;&#21015;&#34920;&#30340;&#21097;&#20313;&#37096;&#20998;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">split</span><span class="hspace">&nbsp;</span><span class="RktSym">l</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">split</span><span class="hspace">&nbsp;</span><span class="RktSym">l</span><span class="hspace">&nbsp;</span><span class="RktSym">w</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">cond</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">null?</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">l</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">values</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">list-&gt;string</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">reverse</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">w</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">)</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">char=?</span></span></span><span class="hspace">&nbsp;</span><span class="RktVal">#\newline</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">car</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">l</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">values</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">list-&gt;string</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">reverse</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">w</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">cdr</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">l</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym"><span class="badlink"><span class="RktValLink">else</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">split</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">cdr</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">l</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">cons</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">car</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">l</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">w</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">split</span><span class="hspace">&nbsp;</span><span class="RktSym">l</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#23427;&#26159;&#19968;&#20010;&#20856;&#22411;&#30340;&#22810;&#20540;&#20989;&#25968;&#65292;&#36890;&#36807;&#36941;&#21382;&#19968;&#20010;&#21333;&#20010;&#21015;&#34920;&#36820;&#22238;&#20004;&#20010;&#20540;&#12290;</p><p>&#36825;&#26679;&#19968;&#20010;&#20989;&#25968;&#30340;&#21512;&#32422;&#21487;&#20197;&#20351;&#29992;&#26222;&#36890;&#20989;&#25968;&#31661;&#22836;<span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;</span></span></span>&#65292;&#27492;&#21518;&#24403;&#23427;&#20316;&#20026;&#26368;&#21518;&#32467;&#26524;&#20986;&#29616;&#26102;&#65292;<span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;</span></span></span>&#29305;&#21035;&#22320;&#22788;&#29702;<span class="RktSym"><span class="badlink"><span class="RktValLink">values</span></span></span>&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">provide</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">contract-out</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">split</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">listof</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">char?</span></span></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">values</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">string?</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">listof</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">char?</span></span></span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#36825;&#26679;&#19968;&#20010;&#20989;&#25968;&#30340;&#21512;&#32422;&#20063;&#21487;&#20197;&#20351;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;*</span></span></span>&#32534;&#20889;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">provide</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">contract-out</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">split</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;*</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">listof</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">char?</span></span></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">values</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">string?</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">listof</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">char?</span></span></span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#21644;&#21069;&#38754;&#19968;&#26679;&#65292;&#24102;<span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;*</span></span></span>&#30340;&#21442;&#25968;&#30340;&#21512;&#32422;&#34987;&#21253;&#35065;&#22312;&#19968;&#23545;&#39069;&#22806;&#30340;&#22278;&#25324;&#21495;&#20013;&#23545;&#65288;&#24182;&#19988;&#24517;&#39035;&#24635;&#26159;&#36825;&#26679;&#34987;&#21253;&#35065;&#65289;&#20013;&#65292;&#24182;&#19988;&#36825;&#20010;&#31354;&#25324;&#21495;&#23545;&#34920;&#31034;&#36825;&#37324;&#27809;&#26377;&#21487;&#36873;&#21442;&#25968;&#12290;&#36825;&#20010;&#32467;&#26524;&#30340;&#21512;&#32422;&#26159;&#22312;<span class="RktSym"><span class="badlink"><span class="RktValLink">values</span></span></span>&#20869;&#37096;&#65306;&#19968;&#20010;&#23383;&#31526;&#20018;&#21644;&#23383;&#31526;&#30340;&#19968;&#20010;&#21015;&#34920;&#12290;</p><p>&#29616;&#22312;&#65292;&#20551;&#35774;&#25105;&#20204;&#36824;&#24076;&#26395;&#30830;&#20445;<span class="RktSym">split</span>&#30340;&#31532;&#19968;&#20010;&#32467;&#26524;&#26159;&#22312;&#21015;&#34920;&#26684;&#24335;&#20013;&#30340;&#36825;&#20010;&#32473;&#23450;&#21333;&#35789;&#30340;&#19968;&#20010;&#21069;&#32512;&#12290;&#22312;&#36825;&#31181;&#24773;&#20917;&#19979;&#65292;&#25105;&#20204;&#38656;&#35201;&#20351;&#29992;&#36825;&#20010;<span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;i</span></span></span>&#21512;&#32422;&#32452;&#21512;&#22120;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">substring-of?</span><span class="hspace">&nbsp;</span><span class="RktSym">s</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">flat-named-contract</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">format</span></span></span><span class="hspace">&nbsp;</span><span class="RktVal">"substring of ~s"</span><span class="hspace">&nbsp;</span><span class="RktSym">s</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">lambda</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">s2</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">and</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">string?</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">s2</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">&lt;=</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">string-length</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">s2</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">string-length</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">s</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">equal?</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">substring</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">s</span><span class="hspace">&nbsp;</span><span class="RktVal">0</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">string-length</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">s2</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">s2</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">provide</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">contract-out</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">split</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;i</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">fl</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">listof</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">char?</span></span></span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">values</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">s</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">fl</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">substring-of?</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">list-&gt;string</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">fl</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">c</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">listof</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">char?</span></span></span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#20687;<span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;*</span></span></span>&#12289;<span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;i</span></span></span>&#32452;&#21512;&#20351;&#29992;&#20989;&#25968;&#20013;&#30340;&#21442;&#25968;&#26469;&#21019;&#24314;&#33539;&#22260;&#30340;&#21512;&#32422;&#12290;&#26159;&#30340;&#65292;&#23427;&#19981;&#21482;&#26159;&#36820;&#22238;&#19968;&#20010;&#21512;&#32422;&#65292;&#32780;&#26159;&#20989;&#25968;&#20135;&#29983;&#20540;&#30340;&#25968;&#37327;&#65306;&#27599;&#20010;&#20540;&#30340;&#19968;&#20010;&#21512;&#32422;&#12290;&#22312;&#36825;&#31181;&#24773;&#20917;&#19979;&#65292;&#31532;&#20108;&#20010;&#21512;&#32422;&#21644;&#20197;&#21069;&#19968;&#26679;&#65292;&#30830;&#20445;&#31532;&#20108;&#20010;&#32467;&#26524;&#26159;<span class="RktSym">char</span>&#21015;&#34920;&#12290;&#19982;&#27492;&#30456;&#21453;&#65292;&#31532;&#19968;&#20010;&#21512;&#32422;&#22686;&#24378;&#26087;&#30340;&#65292;&#22240;&#27492;&#32467;&#26524;&#26159;&#32473;&#23450;&#21333;&#35789;&#30340;&#21069;&#32512;&#12290;</p><p>&#24403;&#28982;&#65292;&#36825;&#20010;&#21512;&#32422;&#23545;&#20110;&#26816;&#26597;&#26469;&#35828;&#26159;&#20540;&#24471;&#30340;&#12290;&#36825;&#37324;&#26377;&#19968;&#20010;&#31245;&#24494;&#24265;&#20215;&#30340;&#29256;&#26412;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">provide</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">contract-out</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">split</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;i</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">fl</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">listof</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">char?</span></span></span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">values</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">s</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">fl</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">string-len/c</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">length</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">fl</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">c</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">listof</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">char?</span></span></span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><h5>7.3.9<tt>&nbsp;</tt><a name="(part._contracts-no-domain)"></a>&#22266;&#23450;&#20294;&#38745;&#24577;&#26410;&#30693;&#25968;&#37327;</h5><p>&#24819;&#35937;&#19968;&#19979;&#20320;&#33258;&#24049;&#20026;&#19968;&#20010;&#20989;&#25968;&#32534;&#20889;&#20102;&#19968;&#20010;&#21512;&#32422;&#65292;&#36825;&#20010;&#20989;&#25968;&#25509;&#21463;&#20854;&#23427;&#19968;&#20123;&#20989;&#25968;&#24182;&#19988;&#19968;&#20010;&#26368;&#32456;&#21069;&#32773;&#24212;&#29992;&#20110;&#21518;&#32773;&#30340;&#25968;&#20540;&#30340;&#21015;&#34920;&#12290;&#38500;&#38750;&#36825;&#20010;&#32473;&#23450;&#30340;&#20989;&#25968;&#30340;&#25968;&#37327;&#21305;&#37197;&#32473;&#23450;&#21015;&#34920;&#30340;&#38271;&#24230;&#65292;&#21542;&#21017;&#20320;&#30340;&#36807;&#31243;&#23601;&#20250;&#38519;&#20837;&#22256;&#38590;&#12290;</p><p>&#32771;&#34385;&#36825;&#20010;<span class="RktSym">n-step</span>&#20989;&#25968;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">(number ... -&gt; (union #f number?)) (listof number) -&gt; void</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">n-step</span><span class="hspace">&nbsp;</span><span class="RktSym">proc</span><span class="hspace">&nbsp;</span><span class="RktSym">inits</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">let</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">inc</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">apply</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">proc</span><span class="hspace">&nbsp;</span><span class="RktSym">inits</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">when</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">inc</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">n-step</span><span class="hspace">&nbsp;</span><span class="RktSym">proc</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">map</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">&#955;</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">x</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">+</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="hspace">&nbsp;</span><span class="RktSym">inc</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">inits</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p><span class="RktSym">n-step</span>&#30340;&#21442;&#25968;&#26159;<span class="RktSym">proc</span>&#65292;&#19968;&#20010;&#20989;&#25968;<span class="RktSym">proc</span>&#30340;&#32467;&#26524;&#35201;&#20040;&#26159;&#25968;&#20540;&#35201;&#20040;&#26159;&#20551;(false)&#65292;&#20197;&#21450;&#19968;&#20010;&#21015;&#34920;&#12290;&#23427;&#25509;&#30528;&#24212;&#29992;<span class="RktSym">proc</span>&#21040;&#36825;&#20010;&#21015;&#34920;<span class="RktSym">inits</span>&#20013;&#12290;&#21482;&#35201;<span class="RktSym">proc</span>&#36820;&#22238;&#19968;&#20010;&#25968;&#20540;&#65292;<span class="RktSym">n-step</span>&#25226;&#37027;&#20010;&#25968;&#20540;&#22788;&#29702;&#20026;&#19968;&#20010;&#22312;<span class="RktSym">inits</span>&#21644;&#36882;&#24402;&#37324;&#30340;&#27599;&#20010;&#25968;&#20540;&#30340;&#22686;&#37327;&#20540;&#12290;&#24403;<span class="RktSym">proc</span>&#36820;&#22238;<span class="RktSym"><span class="badlink"><span class="RktValLink">false</span></span></span>&#26102;&#65292;&#36825;&#20010;&#24490;&#29615;&#20572;&#27490;&#12290;</p><p>&#36825;&#37324;&#26377;&#20004;&#20010;&#24212;&#29992;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">nat -&gt; nat</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">f</span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">printf</span></span></span><span class="hspace">&nbsp;</span><span class="RktVal">"~s\n"</span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">if</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">=</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="hspace">&nbsp;</span><span class="RktVal">0</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="hspace">&nbsp;</span><span class="RktVal"><span class="nobreak">-1</span></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym">n-step</span><span class="hspace">&nbsp;</span><span class="RktSym">f</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">2</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">nat nat -&gt; nat</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">g</span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="hspace">&nbsp;</span><span class="RktSym">y</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">z</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">+</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="hspace">&nbsp;</span><span class="RktSym">y</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">printf</span></span></span><span class="hspace">&nbsp;</span><span class="RktVal">"~s\n"</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">list</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="hspace">&nbsp;</span><span class="RktSym">y</span><span class="hspace">&nbsp;</span><span class="RktSym">z</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">if</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">=</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">z</span><span class="hspace">&nbsp;</span><span class="RktVal">0</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="hspace">&nbsp;</span><span class="RktVal"><span class="nobreak">-1</span></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym">n-step</span><span class="hspace">&nbsp;</span><span class="RktSym">g</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#19968;&#20010;<span class="RktSym">n-step</span>&#30340;&#21512;&#32422;&#24517;&#39035;&#25351;&#23450;<span class="RktSym">proc</span>&#30340;&#34892;&#20026;&#30340;&#20004;&#26041;&#38754;&#65306;&#20854;&#25968;&#37327;&#24517;&#39035;&#22312;<span class="RktSym">inits</span>&#37324;&#21253;&#25324;&#20803;&#32032;&#30340;&#25968;&#37327;&#65292;&#21516;&#26102;&#23427;&#24517;&#39035;&#36820;&#22238;&#19968;&#20010;&#25968;&#20540;&#25110;<span class="RktVal">#f</span>&#12290;&#21518;&#32773;&#26159;&#23481;&#26131;&#30340;&#65292;&#21069;&#32773;&#26159;&#22256;&#38590;&#30340;&#12290;&#20045;&#19968;&#30475;&#65292;&#36825;&#20284;&#20046;&#26263;&#31034;&#19968;&#20010;&#21512;&#32422;&#20998;&#37197;&#20102;&#19968;&#20010;<span style="font-style: italic">&#21487;&#21464;&#25968;&#37327;&#65288;variable-arity&#65289;</span>&#32473;&#20102;<span class="RktSym">proc</span>&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;*</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">#:rest</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">listof</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">any/c</span></span></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">or/c</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">number?</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">false/c</span></span></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>&#28982;&#32780;&#65292;&#36825;&#20010;&#21512;&#32422;&#34920;&#26126;&#36825;&#20010;&#20989;&#25968;&#24517;&#39035;&#25509;&#21463;<span style="font-style: italic">&#20219;&#24847;&#65288;any&#65289;</span>&#25968;&#37327;&#30340;&#21442;&#25968;&#65292;&#32780;&#19981;&#26159;&#19968;&#20010;<span style="font-style: italic">&#29305;&#23450;&#65288;specific&#65289;</span>&#30340;&#20294;<span style="font-style: italic">&#19981;&#30830;&#23450;&#65288;undetermined&#65289;</span>&#30340;&#25968;&#20540;&#12290;&#22240;&#27492;&#65292;&#24212;&#29992;<span class="RktSym">n-step</span>&#21040;<span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">lambda</span></span></span><span class="stt"> </span><span class="RktPn">(</span><span class="RktSym">x</span><span class="RktPn">)</span><span class="stt"> </span><span class="RktSym">x</span><span class="RktPn">)</span>&#21644;<span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">list</span></span></span><span class="stt"> </span><span class="RktVal">1</span><span class="RktPn">)</span>&#36829;&#21453;&#21512;&#32422;&#65292;&#22240;&#20026;&#36825;&#20010;&#32473;&#23450;&#30340;&#20989;&#25968;&#21482;&#25509;&#21463;&#19968;&#20010;&#21442;&#25968;&#12290;</p><p>&#27491;&#30830;&#30340;&#21512;&#32422;&#20351;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">unconstrained-domain-&gt;</span></span></span>&#32452;&#21512;&#22120;&#65292;&#23427;&#20165;&#25351;&#23450;&#19968;&#20010;&#20989;&#25968;&#30340;&#20540;&#22495;&#65292;&#32780;&#19981;&#26159;&#23427;&#30340;&#23450;&#20041;&#22495;&#12290;&#23427;&#25509;&#19979;&#26469;&#21487;&#33021;&#36830;&#25509;&#36825;&#20010;&#21512;&#32422;&#21040;&#19968;&#20010;&#25968;&#37327;&#27979;&#35797;&#20197;&#25351;&#23450;<span class="RktSym">n-step</span>&#30340;&#27491;&#30830;&#21512;&#32422;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">provide</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">contract-out</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">n-step</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-&gt;i</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">proc</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">inits</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">and/c</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">unconstrained-domain-&gt;</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">or/c</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">false/c</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">number?</span></span></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">&#955;</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">f</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">procedure-arity-includes?</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktSym">f</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">length</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">inits</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">inits</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">listof</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">number?</span></span></span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">any</span></span></span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><div class="navsetbottom"><span class="navleft"><div class="nosearchform"></div>&nbsp;&nbsp;</span><span class="navright">&nbsp;&nbsp;<a href="contract-func.html" title="backward to &quot;7.2 函数的简单合约&quot;" data-pltdoc="x">&larr; prev</a>&nbsp;&nbsp;<a href="contracts.html" title="up to &quot;7 合约&quot;" data-pltdoc="x">up</a>&nbsp;&nbsp;<a href="contracts-first.html" title="forward to &quot;7.4 合约：一个完整的例子&quot;" data-pltdoc="x">next &rarr;</a></span>&nbsp;</div></div></div><div id="contextindicator">&nbsp;</div></body></html>